Generally, X-ray imaging identifies contaminants in products by a simple comparison of all the pixels in an image of the product against some value (or “threshold”). For example, every pixel in the image is assigned a grey value and these grey values are compared to a threshold grey value, wherein any pixels having a grey value lower than the threshold (dark pixels), are considered to represent contaminants. This technique may be adequate when the product is homogeneous, however, if the product is non-homogenous and contains light and dark regions, such as a bag of randomly arranged sweets, it is impossible to set a suitable threshold level. If the threshold level is set too high then bags not containing contaminants will trigger false alarms and have to be discarded. This is very costly as each then has to be carefully examined to determine whether it was a true or false alarm, for if the alarm is a true alarm then the source of the foreign particle may need to be established. This examination often has to take place immediately in case further action is required in the case of a true alarm signal.
More advanced imaging techniques are known, which involve looking at more localized changes in an image. Such techniques again involve assigning every pixel in the image a grey value. However, the grey value of each pixel is compared with an average grey value of pixels surrounding a pixel being considered. A threshold value is set and if the difference between the grey value of the pixel and the average grey value of the surrounding pixels is above the threshold, the pixel is deemed to represent a contaminant. This technique is more effective than the simple comparison technique, discussed above, but suffers similar drawbacks since there may be a great difference in grey values between an adjacent pixel bridging an edge of a product, resulting in false contaminant identification. This is particularly a problem with products of uneven shape, for example the bag of sweets, where the edge of the product cannot be predicted.
It is an object of the present invention to provide an improved means for identifying contaminants in a product, particularly foodstuffs, that is more effective with non-homogeneous and/or unevenly shaped products.